﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using iLangl.Security;
using iLangl.BusinessModel.Managers;
using System.Web.Security;

namespace iLangl.Tests.SecurityFixture
{
	[TestClass]
	public class ContactReferenceFixture
	{
		[TestMethod]
		public void ContactReference()
		{
			String username = "sergey.yuryev" + Guid.NewGuid().ToString() + "@gmail.com";
			String password = "test";
			String contactId = "1";

			CustomerAuthenticationService service = new CustomerAuthenticationService();
			String result = service.RegisterUser(username, password);
			Assert.AreEqual(result, MembershipCreateStatus.Success.ToString());

			AuthenticationManager.Instance.AssignContactIdToUserAccount(username, contactId);
			String resultContactId =  AuthenticationManager.Instance.ReadContactIdByUserAccount(username);

			Assert.AreEqual(resultContactId, contactId);

		}
	}
}
